package metier.entities;


import java.util.Date;
import java.util.Date;

import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;


@Entity
@Table(name = "Client_Abonnement")
@AssociationOverrides({
		@AssociationOverride(name = "pk.Client", 
			joinColumns = @JoinColumn(name = "Client_ID")),
		@AssociationOverride(name = "pk.Abonnement", 
			joinColumns = @JoinColumn(name = "Abonnement_ID")) })

public class ClientAbonnement {
	
	
	@EmbeddedId
	private ClientAbonnementId pk=new ClientAbonnementId();
	
	@Temporal(TemporalType.DATE)
	private Date DateDebut;
	@Temporal(TemporalType.DATE)
	private Date DateFin;
	
	
	public ClientAbonnement() {
		super();
	}


	public ClientAbonnementId getPk() {
		return pk;
	}


	public void setPk(ClientAbonnementId pk) {
		this.pk = pk;
	}



	public Date getDateDebut() {
		return DateDebut;
	}


	public void setDateDebut(Date dateDebut) {
		DateDebut = dateDebut;
	}


	public Date getDateFin() {
		return DateFin;
	}


	public void setDateFin(Date dateDebAbn) {
		DateFin = dateDebAbn;
	}
	
	@Transient
	public Client getClient()
	{
		return getPk().getClient();
	}
	
	
	public void setClient(Client client)
	{
		getPk().setClient(client);
	}
	
	
	@Transient
	public Abonnement getAbonnement()
	{
		return getPk().getAbonnement();
	}
	
	
	public void setAbonnement(Abonnement abonnement)
	{
		getPk().setAbonnement(abonnement);
	}


	public ClientAbonnement(ClientAbonnementId pk, Date dateDebut, Date dateFin) {
		super();
		this.pk = pk;
		DateDebut = dateDebut;
		DateFin = dateFin;
	}
	
	
	
	

}
